package com.jiguang.property.controller;


import com.jiguang.property.annotation.Log;
import com.jiguang.property.dto.BuildInfoDTO;
import com.jiguang.property.dto.ParkInfoDTO;
import com.jiguang.property.service.ParkInfoService;
import com.jiguang.property.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2025-03-23
 */
@RestController
@RequestMapping("/parkInfo")
public class ParkInfoController {
    @Autowired
    private ParkInfoService parkInfoService;

    @ApiOperation(value = "查询车位列表")
    @PostMapping("list")
    @Log(name = "查询车位列表")
    public Result list(@RequestBody ParkInfoDTO parkInfoDTO) {
        return parkInfoService.listParkInfo(parkInfoDTO);
    }

    @ApiOperation(value = "查询车位情况")
    @PostMapping("getPark")
    public Result getPark() {
        return parkInfoService.getPark();
    }

    @ApiOperation(value = "通过ID删除车位信息")
    @PostMapping("delete")
    @Log(name = "删除车位信息")
    public Result delete(String parkIds) {
        return parkInfoService.deleteParkInfo(parkIds);
    }

    @ApiOperation(value = "新增车位信息")
    @PostMapping("saveOrUpdate")
    @Log(name = "操作车位信息")
    public Result updateOrAdd(@RequestBody ParkInfoDTO parkInfoDTO) {
        return parkInfoService.updateOrAddParkInfo(parkInfoDTO);
    }
}

